package com.ipcamera.demo.h5.view;


import android.app.Activity;
import android.content.Context;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;


/**
 * author: veepai
 * date: 2019/8/13
 * description: 抽象方法基类
 */
public abstract class BaseActivity extends Activity implements View.OnClickListener {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        //设置当前的抽象布局
        setContentView(getLayout());
        //初始化状态栏
        initToolbar();
        //抽象接受传递过来的数据
        initBundleData(getIntent());
        //抽象初始化视图
        initView();
        //抽象加载数据
        initData();
    }

    protected abstract int getLayout();

    protected abstract void initBundleData(Intent i);

    protected abstract void initView();

    protected abstract void initData();

    protected abstract void onClickEvent(View v);

    /**
     * 初始化状态栏
     */
    private void initToolbar() {

    }

    /**
     * 初始化view 同时监听
     */
   /* public <T extends View> T initById(int id) {


        return vv;
    }*/

    @Override
    public void onClick(View v) {
        onClickEvent(v);
    }

    public Context getContext() {
        return this;
    }
}
